﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.UI;
using Fashion.Common.Const;

namespace A
{
    public static partial class M
    {
        #region 
        
        public static string DisplayDateTime(this DateTime dateTime)
        {
            return dateTime.ToString("dd/MM/yyyy");
        }

        public static string DisplayMoney(this decimal money)
        {
            return String.Format("{0:#,###}", money);
        }

        public static string DisplayIconActive(this bool isActive)
        {
            if (isActive)
                return HtmlCode.ImgIconActive;
            return HtmlCode.ImgIconDeActive;
        }

        public static string DisplayActionLinkByImageActive(this MvcHtmlString htmlString, bool isActive)
        {
            if (isActive)
                return DisplayActionLinkByImage(htmlString, HtmlCode.ImgIconActive);
            return DisplayActionLinkByImage(htmlString, HtmlCode.ImgIconDeActive);
        }

        public static string DisplayActionLinkByImage(this MvcHtmlString htmlString, string htmlCodeImg)
        {
            return htmlString.ToString().Replace(ParameterTemplate.Image, htmlCodeImg);
        }

        #endregion

        public static string GetQueryString(this Page page, string name)
        {
            return page.Request.QueryString[name];
        }
    }
}